 var form;
 var tree;
 var formId;
 var taskId;
 var allEventFunction={};
 var allGridData={};
 var kindEditorObj={};
 var publicButtonValue="";
 var publicData={};
 function loads(pform,tree,id){
	 if(tree!=null){
	  form = pform;
	  taskId = id;
	  formId = tree.key;
      tree = tree;
	  analyticalElementByJson(tree,"body");
	 }
 }
 
 function taskSubmit(saveAsName,buttonValue,buttonConfirm,confirmMessage){
	 if(buttonConfirm=="true"){
		  if(confirm(confirmMessage))
			 {
			}else{
				return false;
			}
	 }
	 var form = new mini.Form("#"+formId);
	 form.validate();
     if (form.isValid() == false) return;
	 var grids = $(".mini-datagrid");
	 publicButtonValue = buttonValue;
	 executeEvent(formId,"submit");
	 var formData = form.getData();
	 
	 for(var i=0;i<grids.length;i++){
		var grid = mini.get(grids.eq(i).attr("id"));
		grid.validate();
        if (grid.isValid() == false) {
                var error = grid.getCellErrors()[0];
                grid.beginEditCell(error.record, error.column);
                return;
          }
		 var gridData = grid.getData();
		 formData[grids.eq(i).attr("id")+"Data"]=gridData;
		 var attrItems=allGridData[grids.eq(i).attr("id")+"Columns"];
		  for(var s=0;s<attrItems.length;s++){
			  var attrItemsValue=[];
			  for(var j=0;j<gridData.length;j++){
				  if(typeof(gridData[j][attrItems[s]])=="object"){
					  attrItemsValue.push(mini.formatDate(gridData[j][attrItems[s]],"yyyy-MM-dd HH:mm").replaceAll("1970-01-01 ","").replaceAll("1970-01-02 ","").replaceAll(" 00:00",""));
				  }else if(typeof(gridData[j][attrItems[s]])=="string"){
					  if(gridData[j][attrItems[s]]==null){
						 attrItemsValue.push(" ");  
					  }else{
						attrItemsValue.push(gridData[j][attrItems[s]].replaceAll("1970-01-01 ","").replaceAll("1970-01-02 ","").replaceAll(" 00:00","")); 
					  }
				  }else{
					  if(gridData[j][attrItems[s]]==null){
						 attrItemsValue.push(" ");  
					  }else{
						attrItemsValue.push(gridData[j][attrItems[s]]); 
					  }
				  }
			  }
			  if(attrItems[s]=="_id"){
					formData[grids.eq(i).attr("id")+attrItems[s]] = attrItemsValue.join(","); 
			  }else{
					formData[attrItems[s]] = attrItemsValue.join(","); 
			  }
			  
		  }
		  
	 }
	 var files = $(".fileValue");
	 for(var i=0;i<files.length;i++){
		 var name = files.eq(i).attr("name");
		 var label = files.eq(i).attr("label");
		 var isrequired = files.eq(i).attr("isrequired");
		 var value = files.eq(i).val();
		 if(isrequired=="true"&&value==""){
			 alert("请上传"+label+"的文件!");
			 return false;
		 }
		 if(name!=null&&name!=""){
			formData[name]=value;
		 }
	 }
	 
	 var allowRichTexts = $(".allowRichText");
	 for(var i=0;i<allowRichTexts.length;i++){
		 var name = allowRichTexts.eq(i).attr("name");
		 var label = allowRichTexts.eq(i).attr("label");
		 var isrequired = allowRichTexts.eq(i).attr("isrequired");
		 var id = allowRichTexts.eq(i).attr("id");
		 var value = kindEditorObj[id].html();
		 if(value.indexOf('"')>-1){
			value =  value.replaceAll("\"","")
		 }
		 if(isrequired=="true"&&value==""){
			 alert("请填写"+label+"的内容!");
			 return false;
		 }
		 if(name!=null&&name!=""){
			formData[name]=value;
		 }
	 }	 
	 formData[saveAsName]=buttonValue;
	 formData = mini.encode(formData);
	 submit(taskId,{formData:formData})
 }
 
 function taskSave(){
	var form = new mini.Form("#"+formId);
	executeEvent(formId,"save");
	 var grids = $(".mini-datagrid");
	 var formData = form.getData();
	 for(var i=0;i<grids.length;i++){
		var grid = mini.get(grids.eq(i).attr("id"));
		 var gridData = grid.getData();
		 formData[grids.eq(i).attr("id")+"Data"]=gridData;
		 var attrItems=allGridData[grids.eq(i).attr("id")+"Columns"];
		  for(var s=0;s<attrItems.length;s++){
			  var attrItemsValue=[];
			  for(var j=0;j<gridData.length;j++){
				  if(typeof(gridData[j][attrItems[s]])=="object"){
					  attrItemsValue.push(mini.formatDate(gridData[j][attrItems[s]],"yyyy-MM-dd HH:mm").replaceAll("1970-01-01 ","").replaceAll("1970-01-02 ","").replaceAll(" 00:00",""));
				  }else if(typeof(gridData[j][attrItems[s]])=="string"){
					  if(gridData[j][attrItems[s]]==null){
						 attrItemsValue.push(" ");  
					  }else{
						attrItemsValue.push(gridData[j][attrItems[s]].replaceAll("1970-01-01 ","").replaceAll("1970-01-02 ","").replaceAll(" 00:00","")); 
					  }
				  }else{
					  if(gridData[j][attrItems[s]]==null){
						 attrItemsValue.push(" ");  
					  }else{
						attrItemsValue.push(gridData[j][attrItems[s]]); 
					  }
				  }
			  }
			  if(attrItems[s]=="_id"){
					formData[grids.eq(i).attr("id")+attrItems[s]] = attrItemsValue.join(","); 
			  }else{
					formData[attrItems[s]] = attrItemsValue.join(","); 
			  }
			  
		  }
		  
	 }
	 var files = $(".fileValue");
	 for(var i=0;i<files.length;i++){
		 var name = files.eq(i).attr("name");
		 var value = files.eq(i).val();
		 if(name!=null&&name!=""){
			formData[name]=value;
		 }
	 }
	 var allowRichTexts = $(".allowRichText");
	 for(var i=0;i<allowRichTexts.length;i++){
		 var name = allowRichTexts.eq(i).attr("name");
		 var id = allowRichTexts.eq(i).attr("id");
		 var value = kindEditorObj[id].html();
		 if(value.indexOf('"')>-1){
			value =  value.replaceAll("\"","");
		 }
		 if(name!=null&&name!=""){
			formData[name]=value;
		 }
	 }
	 executeEvent(formId,"save");
	 formData = mini.encode(formData);
	 saveData(taskId,{formData:formData})
 }

 

 
 
 
	
 
 function getSaveAsName(formElemnet){
		var saveAsName = "";
		if(formElemnet.extra.saveAs!=null){
			saveAsName = 'name="'+formElemnet.extra.saveAs.name+'"';
		}
		return saveAsName;
 }
  function getFieldName(formElemnet){
		var fieldName = "";
			if(formElemnet.extra.saveAs!=null){
				fieldName = formElemnet.extra.saveAs.name;
			}else{
				fieldName = formElemnet.extra.id;
			}
		return fieldName;
  }			
  function getMasking(formElemnet){
		var masking = "";
		if(formElemnet.extra.masking!=null){
			masking = 'vtype="'+formElemnet.extra.masking+'"';
		}
		return masking;
 }
  function getRequired(formElemnet){
		var required="";
		if(formElemnet.required){
			required='<span style="color: red">*</span>';
		}
		return required;
 }
 function getEnabled(formElemnet){
		var enabled;
		if(formElemnet.extra.disabled){
			enabled=false;
		}else{
			enabled=true;
		}
		return enabled;
 }

 function selectedFile(thiss,id,acValueMultiple,destination){
	   uploadFileById(thiss,id,function(mes){
		for(var i=0;i<mes.length;i++){
			var img = "";
			 if(mes[i].suffix=="jpg"||mes[i].suffix=="png"||mes[i].suffix=="gif"){
				img="<img src='/suite/doc/"+mes[i].id+"' style='height:60px;border:0px;' >";
			 }else{
				img="<img src='/suite/plugins/img/attach/attach.png'  style='height:60px;border:0px;' >";
			 }
			if(destination=="newFile"){
				if(!acValueMultiple){
					thiss.disabled=true;
				}
				var div="<div id='fileView"+mes[i].id+"'  style='border: 1px solid #DEE5E7;background-color: #EDF1F2;display: block;float: left;margin-right:2px;' >  <div  style='border-bottom: 1px solid #DEE5E7;padding: 5px;' >"+mes[i].name+"."+mes[i].suffix+"&nbsp;<a style='padding: 2px 2px;text-decoration:none;' href=javascript:deleteDocument('"+id+"','"+mes[i].id+"') >删除</a></div> <div  style='height:60px;width:100%;text-align: center;background-color: #F3F5F6;padding-bottom:3px;padding-top:3px;' > 				<a  href='/suite/doc/"+mes[i].id+"' >"+img+"</a> 			  </div> 			</div>"
				$("#"+id).parent().before(div);
				var value =  $("#"+id+"Value").val();
				var name =  $("#"+id+"Name").val();
				if(value==""||value==null){
					 $("#"+id+"Value").val(mes[i].id)
					 $("#"+id+"Name").val(mes[i].name)
				}else{
					$("#"+id+"Value").val(value+","+mes[i].id)
					$("#"+id+"Name").val(name+","+mes[i].name)
				}
			}else{
				 var div="<div id='fileView"+mes[i].id+"'  style='border: 1px solid #DEE5E7;background-color: #EDF1F2;display: block;float: left;margin-right:2px;' >  <div  style='border-bottom: 1px solid #DEE5E7;padding: 5px;' >"+mes[i].name+"."+mes[i].suffix+"</div> <div  style='height:60px;width:100%;text-align: center;background-color: #F3F5F6;padding-bottom:3px;padding-top:3px;' > 				<a  href='/suite/doc/"+mes[i].id+"' >"+img+"</a> 			  </div> 			</div>"
				$("#fileView"+mes[i].id).remove();
				$("#"+id).parent().before(div);
				$("#"+id+"Value").val(mes[i].id);
				
			}
		}
	   })   
}

function selectedFileGrid(thiss,id){
	   uploadFile(thiss,function(mes){
		   var data  = mes;
		   var grid = mini.get(id);
		   grid.setData(data);
		   var columns  = allGridData[id+"ColumnsNoName"]
		   for(var i=0;i<data.length;i++){
			   var row = grid.getRow(i);
			   var dataName={};
			   for(var j=0;j<columns.length;j++){  
					grid.beginEditCell(row,grid.getColumn(j+1));
					grid.getCellEditor(grid.getColumn(j+1),row).setValue(data[i][columns[j]]);
					if(grid.getCellEditor(grid.getColumn(j+1),row).getText!=null){
						var columnName = columns[j]+"Name";
						var text = grid.getCellEditor(grid.getColumn(j+1),row).getText();
						if(text!=""){
							dataName[columnName] = text;
						}
					}
				} 
				grid.updateRow(row,dataName);
		   }
	   })
}

var gridTextFileUploadData=[];
function setGridTextFileUploadData(gridId,filePath,fieldName){
	gridTextFileUploadData.push({gridId:gridId,filePath:filePath,fieldName:fieldName})
}


function selectedFileGridTextFileUpload(fileId,gridId,rowIndex,fieldName,filePath){
	var grid = mini.get(gridId);
	var row = grid.getRow(rowIndex);
	var colunm = grid.getColumn(fieldName);
	grid.updateColumn(colunm,{"readOnly":false});
	 var data = {filePath:filePath} 
     $.ajaxFileUpload( {  
        url : '/suite/plugins/servlet/UploadFile',//用于文件上传的服务器端请求地址  
        secureuri : false,//一般设置为false  
		data:data,
        fileElementId : fileId,//文件上传控件的id属性  
        dataType : 'json',//返回值类型 一般设置为json  
        success : function(data, status) //服务器成功响应处理函数  
        {  
           // alert(mini.encode(data));//从服务器返回的json中取出message中的数据,其中message为在struts2中定义的成员变量  
            if (typeof (data.error) != 'undefined') {  
                if (data.error != '') {  
                    alert(data.error);  
                } else {  
                    alert(data.message);  
                }  
            } else{
				var data  = data[0];
				grid.beginEditCell(row,colunm);
				var editor = grid.getCellEditor(colunm,row);
				editor.setValue(data.id+"#"+data.name+"."+data.suffix);
				grid.commitEdit();
				grid.updateColumn(colunm,{"readOnly":true});
			}
        },  
        error : function(data, status, e)//服务器响应失败处理函数  
        {  
            alert(e);  
        }  
    }) 
}

function deleteDocumentGridTextFileUpload(id,gridId,rowIndex,fieldName){
		var grid = mini.get(gridId);
		var row = grid.getRow(rowIndex);
		var colunm = grid.getColumn(fieldName);
		grid.updateColumn(colunm,{"readOnly":false});
		var rs = execute("deletedocument",{id:id});
		if(rs){
			setTimeout(function(){
				grid.beginEditCell(row,colunm);
				var editor = grid.getCellEditor(colunm,row);
				editor.setValue("");
				grid.commitEdit();
				grid.updateColumn(colunm,{"readOnly":true});
			}, 100);
			
		}
}

function deleteDocument(fieldId,id){
		var rs = execute("deletedocument",{id:id});
		if(rs){
			$("#fileView"+id).remove();
			var value = $("#"+fieldId+"Value").val();
			if(value.replace(","+id,"").replace(id,"")==""){
				document.getElementById(fieldId).disabled="";
			}
			$("#"+fieldId+"Value").val(value.replace(","+id,"").replace(id,""));
		}
}

function addRow(id) {
			var grid = mini.get(id);
			var rs=false;
			if(grid[grid.id+"AddRow"]!=null){
				var rs = eval(grid[grid.id+"AddRow"]())
			}
			if(!rs){
				var newRow = {};
				grid.addRow(newRow, -1);
				grid.validateRow(newRow);   //加入新行，马上验证新行
				grid.beginEditCell(newRow,grid.getColumn(1));
			}
        }
function removeRow(id) {
		var grid = mini.get(id);
		var rs=false;
		if(grid[grid.id+"RemoveRow"]!=null){
			var rs = eval(grid[grid.id+"RemoveRow"]())
		}	
		var rows = grid.getSelecteds();
		if(!rs){
			if (rows.length > 0) {
					grid.removeRows(rows, false);
			}
		}
		if(grid[grid.id+"RemoveRowComplete"]!=null){
			eval(grid[grid.id+"RemoveRowComplete"]())
		}
}

function beforenodeselect(e) {
            //禁止选中父节点
            if (e.isLeaf == false) e.cancel = true;
}
function beforefolderselect(e) {
            //禁止选中父节点
            if (e.node.type != 2) e.cancel = true;
}
function beforedocumentselect(e) {
            //禁止选中父节点
            if (e.node.type != 1) e.cancel = true;
}
function  beforecontentselect(e) {
            //禁止选中父节点
            if (e.node.type != 1&&e.node.type != 2) e.cancel = true;
}

function isMultipleTheAllowInput(thiss,flag){
	if(!flag&&thiss.getValue()!=""){
		thiss.setAllowInput(false);
	}else{
		thiss.setAllowInput(true);
	}
}

function setListValue(value,parentKey,fieldName,isName){
		if(value!=""&&value!=null&&value!="[]"&&value!=","){
					if(allGridData[parentKey]==null){
						var gridData = [];
						if(typeof(value)=="string"){
							if(value.indexOf(",")>-1){
								value=value.split(",");
							}else{
								value=value.split("; ");
							}
						}
						for(var i=0;i<value.length;i++){
							var textList={};
							textList[fieldName]=value[i];
							gridData.push(textList);
						}
						allGridData[parentKey]=gridData;
					}else{
						var gridData = allGridData[parentKey];
						if(typeof(value)=="string"){
							if(value.indexOf(",")>-1){
								value=value.split(",");
							}else{
								value=value.split("; ");
							}
						}
						for(var i=0;i<value.length;i++){
							var textList;
							if(gridData[i]==null){
								textList={};
							}else{
								textList= gridData[i];
							}
							textList[fieldName]=value[i];
							gridData[i]=textList;
						}
						allGridData[parentKey]=gridData;
					}
		}
		if(allGridData[parentKey+"Columns"]==null){
			allGridData[parentKey+"Columns"]=[fieldName];	
		}else{
			allGridData[parentKey+"Columns"].push(fieldName);
		}
		if(isName==null||!isName){
			if(allGridData[parentKey+"ColumnsNoName"]==null){
					allGridData[parentKey+"ColumnsNoName"]=[fieldName];	
			}else{
					allGridData[parentKey+"ColumnsNoName"].push(fieldName);
			}
		}
} 

function formExcelexport(id){
	var grid = mini.get(id);
	var columns = grid.getColumns();
	var headerNames = [];
	var headerNameTitles = [];
	var data = grid.getData();
	if(data==""||data==null){
		data=[];
	}
	data = JSON.stringify(data);
	for(var i=0;i<columns.length;i++){
		var headerName = columns[i].header;
		var field = columns[i].field;
		if(field!=null){
			if(headerName.indexOf("<")>-1){
				headerName=headerName.substring(0,headerName.indexOf("<"));
				headerNames.push(field);
				headerNameTitles.push(headerName);
			}else{
				headerNames.push(field);
				headerNameTitles.push(headerName);
			}
		}
	}
	$("#excelexportIframe"+id).remove();
	$("#excelexportForm"+id).remove();
	var iframe = $("body").append("<iframe id='excelexportIframe"+id+"' name='excelexportIframe"+id+"' style='display:none;'  ></iframe>");
	var form = $('<form  action="/suite/plugins/servlet/ExportExcelServlet" method="GET" name="excelexportForm' + id + '" id="excelexportForm' + id + '" target="excelexportIframe'+id+'" ></form>');
	$('<input type="hidden" name="fileName" value="' + $("#"+id+"label").text().substring(0,$("#"+id+"label").text().length-1) + '" />').appendTo(form);
	$('<input type="hidden" name="header" value="' + headerNames + '" />').appendTo(form);
	$('<input type="hidden" name="headerTitle" value="' + headerNameTitles + '" />').appendTo(form);
	$("<input type='hidden' name='data' value='" + data + "' />").appendTo(form);
	$(form).css('position', 'absolute');
    $(form).css('top', '-1200px');
    $(form).css('left', '-1200px');
    $(form).appendTo('body');
	$("#excelexportForm"+id).submit();
}


function onactivechanged(id){
	var tabs = mini.get(id);
	var tab = tabs.getActiveTab();
	if (tabs.getTabBodyEl(tab).clientHeight < tabs.getTabBodyEl(tab).scrollHeight){
		tabs.setHeight(tabs.getTabBodyEl(tab).scrollHeight+30);
	}else{
	}
}

 function analyticalElementByJson(obj,parentKey){
	 if(obj.key!=null){
		 appendElement(obj.key,parentKey)
		 var children = obj.children;
		 
		 if(obj.children.length==1){
			 children = obj.children[0];
		 }
		 for(var i=0;i<children.length;i++){
			if(typeof(children[i])=='string'){
				appendElement(children[i],obj.key);
			}else if(children[i].length>1){
				for(var j=0;j<children[i].length;j++){
					 analyticalElementByJson(children[i][j],obj.key)
				 }
			 }else if(children[i].length==1){  
				analyticalElementByJson(children[i],obj.key)
			 }else if(children[i].length==0){
			 }else{
				analyticalElementByJson(children[i],obj.key) 
			 }
		 }
		
		 
	 }else{
		 appendElement(obj,parentKey);
	 }
	 if(obj.buttons!=null){
	     var buttons = obj.buttons;
		 for(var i=0;i<buttons.length;i++){
				analyticalElementByJson(buttons[i],obj.key) 
		 }
	 }
	 
	 
	 
 }
 

 
 $(function(){
	 var messages = $(".message");
	 for(var i=0;i<messages.length;i++){
		 var  divheight = messages.eq(i).height();
		 var height = document.getElementById(messages.eq(i).attr("id")).scrollHeight;
		 if(height>divheight){
			 //if(document.body.scrollHeight>1500){
			//	 height = height+(height/3.5);
			//}else if(document.body.scrollHeight>1000){
			//	 height = height+(height/5);
			//}else if(document.body.scrollHeight>500){
			//	 height = height+(height/8);
			//}else{
			//	 height = height+(height/10);
			//}
			 $(document.getElementById(messages.eq(i).attr("id"))).height(height);
			  $(document.getElementById(messages.eq(i).attr("id"))).parent().parent().find(".form-field").height(height);
			  $(document.getElementById(messages.eq(i).attr("id"))).parent().parent().find(".form-label").height(height);
			  $(document.getElementById(messages.eq(i).attr("id"))).parent().parent().height(height+16);
		}
	 }
	 var noteDiv = "<br /><div id='note' style='width:800px;MARGIN-RIGHT: auto;MARGIN-LEFT: auto;' >"
	 noteDiv+="<table class='threadTable' border='1' cellspacing='0' cellpadding='0' bordercolor='#000000' bordercolordark='#FFFFFF' bgcolor='#FFFFFF' width='770' ><tr><th colspan='4' height='50' >附件和评论</th><tr><tr><th width='70' >评论人</th><th width='150' >职位</th><th width='400' >内容</th><th width='150' >评论时间</th></tr>"
	 for(var i=0;i<note.length;i++){
		 noteDiv+="<tr><td width='100' >"+note[i].authorName+"</td><td width='150' >"+note[i].groupName+"</td><td width='400' >"+note[i].content.content+"</td><td width='150' >"+note[i].createTimestamp+"</td></tr>"
	 }
	 noteDiv+="</table></div><br /><br /><br />"
	 $("#body").append(noteDiv)
 })
 
 function appendElement(key,parentKey){
	 
	 //alert(JSON.stringify(form[key]))
	 //alert(JSON.stringify(key))
	 //alert(form[key].extra.typeName)
	//alert(parentKey)
	 if(typeof(key)=="object"){
		 analyticalElementByJson(key[0],parentKey)
	 }else if(form[key]==null){ 
	 }else{
	 switch(form[key].extra.typeName)
	 {
	 case "form":
			$("#"+parentKey).append('<div id="'+form[key].extra.key+'" fieldid="'+form[key].extra.id+'" style="width:800px;MARGIN-RIGHT: auto;MARGIN-LEFT: auto;" class="form-div" ><p>流程编号：'+processId+'&nbsp;&nbsp;&nbsp;流程名称：'+processName+'</p><a  href="javascript:window.print()" class="mini-button" style="position:absolute; right:0; top:0;"  >打印</a></div>')
	   break;
	   
	 case "section":
		   $("#"+parentKey).append('<div class="field-one" ><div class="mini-panel" title="'+form[key].label+'" style="width:100%;height:100%;margin:5px 0;" showCollapseButton="true"  allowResize="false" collapseOnTitleClick="true"><div style="height:100%;margin:-1px;" id="'+form[key].extra.key+'" fieldid="'+form[key].extra.id+'"   class="form-div" ></div></div></div>')	  
	   break;
	 case "tabs_container":
			$("#"+parentKey).append('<div class="field-one" ><div id="'+form[key].extra.key+'" fieldid="'+form[key].extra.id+'" class="mini-tabs" activeIndex="0" onactivechanged=onactivechanged("'+form[key].extra.key+'") style="width:100%;height:100%;margin:5px 0;" plain="true"></div></div>')
	   break;
	 case "tab":
			$("#"+parentKey).append('<div title="'+form[key].label+'" ><div id="'+form[key].extra.key+'" fieldid="'+form[key].extra.id+'" class="form-div" style="margin:-1px;" ></div></div>')
	   break;
	 case "grid":
			var toolbar="";
			var readOnly="";
				fieldHeight=116;
				formHeight=100;
				gridHeight=60;
	        var grid = '<table id="'+form[key].extra.id+'" border="1" cellspacing="0" cellpadding="0" bordercolor="#000000" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" width="99%" class="'+form[key].extra.id+' grids threadTable" ><tr></tr></table>';
			$("#"+parentKey).append('<div class="field-one" style="height:'+fieldHeight+'px;" id="'+form[key].extra.id+'_field" ><p  id="'+form[key].extra.id+'label"  >'+form[key].label+'：</p>'+grid+'</div>')
	   break;
	 case "text":
			var saveAsName = getSaveAsName(form[key]);
			var required= getRequired(form[key]);
			var masking = getMasking(form[key]);
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key].value;
			}
			if(form[key].extra.view=="list"){
				var fieldName = getFieldName(form[key]);
				var vtype = "";
				if(form[key].required==true){
					vtype="required"
				}
				if(form[key].extra.masking!=""&&form[key].extra.masking!=null){
				   vtype+=";"+form[key].extra.masking
				}
				var readOnly = true;
				if(form[key].mutable){
					readOnly = false;
				}
				if(value.indexOf("[")==0){
					value = value.substring(1,value.length-1).split(",");
				}
				setListValue(value,parentKey,fieldName);
				var dataOptions="";
				if(form[key].extra.customCSS!=null&&form[key].extra.customCSS.indexOf("file;")>-1){
					var filePath = form[key].extra.customCSS.split(";")[1];
					setGridTextFileUploadData(parentKey,filePath,fieldName);
					if(!readOnly){
						if(form[parentKey].mutable){
							readOnly=false;
						}else{
							readOnly=true;
						}
					}
					dataOptions = 'data-options={filePath:"'+filePath+'",gridId:"'+parentKey+'",readOnlyFile:"'+readOnly+'"}'
				}
				if(form[key].extra.customCSS=="datetime"){
					$("."+parentKey+" tr").eq(0).append('<th id="'+fieldName+'" >'+form[key].label+'</th>')
				}else if(form[key].extra.customCSS=="date"){
					$("."+parentKey+" tr").eq(0).append('<th id="'+fieldName+'" >'+form[key].label+'</th>')
				}else if(form[key].extra.customCSS=="time"){
					$("."+parentKey+" tr").eq(0).append('<th id="'+fieldName+'" >'+form[key].label+'</th>')
				}else if(form[key].extra.customCSS!=null&&form[key].extra.customCSS.indexOf("rule;")>-1){
					var url = "/suite/plugins/servlet/execute/"+form[key].extra.customCSS.split(";")[1];
					var id = form[key].extra.customCSS.split(";")[2];
					var label = form[key].extra.customCSS.split(";")[3];
					if(value!=null&&value!=""){
						if(typeof(value)!="object"){
							value = value.split("; ");
						}
						var texts=[];
						
						for(var i=0;i<value.length;i++){
								$.ajax({
									   url: url,
									   type:"post",
									   data:{key:value[i]},
									   async:false,
										   success: function (rstext) {
												var rsList =  eval(rstext);
												if(rsList.length>0){
													texts.push(rsList[0][label]);
												}else{
													texts.push("");
												}
											},
											error: function () {
										   }
								});
							
						}
						setListValue(texts,parentKey,fieldName+"Name",true);
					}
					$("."+parentKey+" tr").eq(0).append('<th id="'+fieldName+'" >'+form[key].label+'</th>')
				}else{
					var width = form[key].extra.customCSS;
					if(dataOptions==""){
						if(width==""||width==null){
							width="150"
						}
					}else{
						width="200"
					}
					$("."+parentKey+" tr").eq(0).append('<th id="'+fieldName+'" >'+form[key].label+'</th>')
					//$("."+parentKey+">div").append('<div field="'+fieldName+'"  '+dataOptions+' name="'+fieldName+'" width="'+width+'" dataType="string" allowSort="true" headerAlign="center" vtype="'+vtype+'" readOnly='+readOnly+' >'+form[key].label+required+' <input property="editor"  emptyText="'+form[key].instructions+'"   class="mini-textbox" style="width:100%;"/></div>  ');
				}
			}else{
				var fieldCss = "field";
				if(form[key].extra.labelPosition=="left"){
					fieldCss="field-two"
				}else if(form[key].extra.labelPosition=="above"){
					fieldCss="field-one"
				}
				if(form[key].extra.customCSS=="none"){
					$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field" ></div>  </div>')
				}else if(form[key].extra.customCSS!=null&&form[key].extra.customCSS.indexOf("rule;")>-1){
					var url = "/suite/plugins/servlet/execute/"+form[key].extra.customCSS.split(";")[1];
					var id = form[key].extra.customCSS.split(";")[2];
					var label = form[key].extra.customCSS.split(";")[3];
					var text="";
						if(value!=null&&value!=""){
							$.ajax({
								   url: url,
								   type:"post",
								   data:{key:value},
								   async:false,
									   success: function (rstext) {
											var rsList =  eval(rstext);
											if(rsList.length>0){
												text = rsList[0][label];
											}else{
												text = "";
											}
										},
										error: function () {
									   }
							});
						}
					//var events = setCustomEvents(key);
					$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field" ><input id="'+form[key].extra.id+'"  enabled='+form[key].mutable+' '+saveAsName+' emptyText="'+form[key].instructions+'" required="'+form[key].required+'"  class="mini-autocomplete" valueField="'+id+'" textField="'+label+'"  url="'+url+'"  value="'+value+'" text="'+text+'" /></div>  </div>')
				}else{
					//var events = setCustomEvents(key);
					$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field" ><input id="'+form[key].extra.id+'" '+masking+' enabled='+form[key].mutable+' '+saveAsName+' emptyText="'+form[key].instructions+'" required="'+form[key].required+'" class="mini-textbox"  value="'+value+'" /></div>  </div>')
				}
			}
	  break;
     case "email":
			var saveAsName = getSaveAsName(form[key]);
			var required= getRequired(form[key]);
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key].value;
			}
			if(form[key].extra.view=="list"){
				var fieldName = getFieldName(form[key]);
				var vtype="email";
				if(form[key].required==true){
					vtype=vtype+";required"
				}
				var readOnly = true;
				if(form[key].mutable){
					readOnly = false;
				}
				if(value.indexOf("[")==0){
					value = value.substring(1,value.length-1).split(",");
				}
				setListValue(value,parentKey,fieldName);
				var width = form[key].extra.customCSS;
				if(width==""||width==null){
					width="100"
				}
				$("."+parentKey+" tr").eq(0).append('<th id="'+fieldName+'" >'+form[key].label+'</th>')
				//$("."+parentKey+">div").append('<div field="'+fieldName+'"  name="'+fieldName+'" width="'+width+'" dataType="string" allowSort="true" headerAlign="center" vtype="'+vtype+'" readOnly='+readOnly+' >'+form[key].label+required+' <input property="editor"  emptyText="'+form[key].instructions+'"   class="mini-textbox" /></div>  ');
			}else{
				var fieldCss = "field";
				if(form[key].extra.labelPosition=="left"){
					fieldCss="field-two"
				}else if(form[key].extra.labelPosition=="above"){
					fieldCss="field-one"
				}
				//var events = setCustomEvents(key);
				$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled='+form[key].mutable+' '+saveAsName+' emptyText="'+form[key].instructions+'" required="'+form[key].required+'" vtype="email" class="mini-textbox"  value="'+value+'" /></div>  </div>')
			}
   	  break;
	 case "message":
			var height = form[key].extra.customCSS;
			if(height==""||height==null){
					height="50"
			}
			$("#"+parentKey).append('<div class="field-one" style="height:'+(Number(height)+16)+'px;" id="'+form[key].extra.id+'_field" ><div class="form-label" style="height:'+height+'px;" >'+form[key].label+'：</div><div class="form-field" style="height:'+height+'px;" ><div id="'+form[key].extra.id+'" style="overflow:auto;height:'+height+'px;" class="message"  >'+form[key].extra.richText+'</div></div>  </div>')
		break;
	case "paragraph":
			var saveAsName = getSaveAsName(form[key]);
			var required= getRequired(form[key]);
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key].value;
			}
			var fieldCss = "field";
			var fieldHeight = "";
			var fieldHeight1 = "";
			var fieldHeight2 = "height:34px;";
			if(form[key].extra.height==7){
				fieldHeight="height:116px;"
				fieldHeight1="height:100px;"
				fieldHeight2="height:100px;"
			}else if(form[key].extra.height==15){
				fieldHeight="height:156px;"
				fieldHeight1="height:140px;"
				fieldHeight2="height:140px;"
			}
			if(form[key].extra.labelPosition=="left"){
					fieldCss="field-two"
				}else if(form[key].extra.labelPosition=="above"){
					fieldCss="field-one"
			}
			//var events = setCustomEvents(key);
			if(form[key].extra.allowRichText=="true"){
				fieldCss="field-one"
				if(form[key].extra.height==15){
					fieldHeight="width:100%;height:356px;"
					fieldHeight1="width:100%;height:340px;"
					fieldHeight2="width:100%;height:320px;"
				}else{
					fieldHeight="width:100%;height:256px;"
					fieldHeight1="width:100%;height:240px;"
					fieldHeight2="width:100%;height:220px;"
				}
				if(form[key].mutable){
					
					$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" style="'+fieldHeight+'"  ><div class="form-label" style="'+fieldHeight1+'"  >'+form[key].label+'：'+required+'</div><div class="form-field" style="'+fieldHeight1+'"  ><textarea style="'+fieldHeight2+'" label='+form[key].label+' id="'+form[key].extra.id+'"  '+saveAsName+'  isrequired="'+form[key].required+'"  class="allowRichText"   >'+value+'</textarea></div>  </div>')
					kindEditorObj[form[key].extra.id] = KindEditor.create('#'+form[key].extra.id, {
						cssPath : '/suite/plugins/kindeditor/plugins/code/prettify.css',
						uploadJson : '/suite/plugins/kindeditor/upload_json.jsp',
						fileManagerJson : '/suite/plugins/kindeditor/file_manager_json.jsp',
						resizeType:0
					});
				}else{
					$("#"+parentKey).append('<div class="'+fieldCss+'" style="height:66px;" id="'+form[key].extra.id+'_field"  ><div class="form-label" style="height:50px;"  >'+form[key].label+'：'+required+'</div><div class="form-field" style="height:50px;"  ><div style="overflow:auto;height:50px;" class="message" id="'+form[key].extra.id+'"  >'+form[key].extra.richText+'</div></div>  </div>')
				}
			}else{
				$("#"+parentKey).append('<div class="'+fieldCss+'" style="'+fieldHeight+'" id="'+form[key].extra.id+'_field" ><div class="form-label" style="'+fieldHeight1+'"  >'+form[key].label+'：'+required+'</div><div class="form-field" style="'+fieldHeight1+'"  ><textarea style="'+fieldHeight2+'" id="'+form[key].extra.id+'" enabled='+form[key].mutable+' '+saveAsName+' emptyText="'+form[key].instructions+'" required="'+form[key].required+'"  class="mini-textarea"  value="'+value+'" ></textarea></div>  </div>')
			}
		break;
	case "longText":
			var required= getRequired(form[key]);
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key].value;
			}
			var fieldName = getFieldName(form[key]);
			var vtype="";
			if(form[key].required==true){
					vtype="required"
			}
			var readOnly = true;
			if(form[key].mutable){
					readOnly = false;
			}
			var width = form[key].extra.customCSS;
			if(width==""||width==null){
				width="200"
			}
			if(value.indexOf("[")==0){
					value = value.substring(1,value.length-1).split(",");
				}
			setListValue(value,parentKey,fieldName);
			$("."+parentKey+" tr").eq(0).append('<th id="'+fieldName+'" >'+form[key].label+'</th>')
			//$("."+parentKey+">div").append('<div field="'+fieldName+'"  name="'+fieldName+'" width="'+width+'" dataType="string" allowSort="true" headerAlign="center" vtype="'+vtype+'" readOnly='+readOnly+' >'+form[key].label+required+' <textarea property="editor"  emptyText="'+form[key].instructions+'"   class="mini-textarea" ></textarea></div>  ');
		break;
	 case "number":
			var saveAsName = getSaveAsName(form[key]);
			var required= getRequired(form[key]);
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key].value;
			}
			var subType = form[key].extra.subType;
			if(subType=="integer"){
				subType="int";
			}else{
				subType="float";
			}
			if(form[key].extra.view=="list"){
				var fieldName = getFieldName(form[key]);
				var vtype=subType;
				if(form[key].required==true){
					vtype=vtype+";required"
				}
				var readOnly = true;
				if(form[key].mutable){
					readOnly = false;
				}
				if(value.indexOf("[")==0){
					value = value.substring(1,value.length-1).split(",");
				}
				setListValue(value,parentKey,fieldName);
				var width = form[key].extra.customCSS;
				if(width==""||width==null){
					width="80"
				}
				$("."+parentKey+" tr").eq(0).append('<th id="'+fieldName+'" >'+form[key].label+'</th>')
				//$("."+parentKey+">div").append('<div field="'+fieldName+'"  name="'+fieldName+'" width="'+width+'" dataType="'+subType+'" allowSort="true" headerAlign="center" vtype="'+vtype+'" readOnly='+readOnly+' >'+form[key].label+required+' <input property="editor"  emptyText="'+form[key].instructions+'"   class="mini-textbox" /></div>  ');
			}else{
				var fieldCss = "field";
				if(form[key].extra.labelPosition=="left"){
					fieldCss="field-two"
				}else if(form[key].extra.labelPosition=="above"){
					fieldCss="field-one"
				}
				//var events = setCustomEvents(key);
				$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled="'+form[key].mutable+'" vtype="'+subType+'" '+saveAsName+' emptyText="'+form[key].instructions+'" required="'+form[key].required+'" class="mini-textbox"  value="'+value+'" /></div>  </div>')
			}
		break;
	 case "radio":
			var saveAsName = getSaveAsName(form[key]);
			var required= getRequired(form[key]);
			var enabled=getEnabled(form[key]);
			var data;
			if(form[key].extra.importChoices=="literal"){
				data=form[key].extra.choices.entries;
			}else{
				var displayValues = form[key][form[key].extra.displayValues];
				var displayLabels = form[key][form[key].extra.displayLabels];
				if(displayValues.indexOf("[")==0){
					var displayValues = displayValues.substring(1,displayValues.length-1).split(",");
					var displayLabels = displayLabels.substring(1,displayLabels.length-1).split(",");
				}
				if(typeof(displayValues)=="string"){
					data =[{id:displayValues,label:displayLabels}];
				}else{
					var subData = [];
					for(var i=0;i<displayValues.length;i++){
						var obj = {id:displayValues[i],label:displayLabels[i]};
						subData.push(obj)
					}
					data = subData;
				}
			}
			data = JSON.stringify(data);
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key].value;
			}
			if(value==null||value==""){
				value=form[key][form[key].extra.defaultChoice];
			}
			var fieldCss = "field";
				if(form[key].extra.labelPosition=="left"){
					fieldCss="field-two"
				}else if(form[key].extra.labelPosition=="above"){
					fieldCss="field-one"
				}
			//var events = setCustomEvents(key);
			$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><div id="'+form[key].extra.id+'" enabled="'+enabled+'"  '+saveAsName+' required="'+form[key].required+'" class="mini-radiobuttonlist" repeatItems="20" repeatLayout="table" repeatDirection="horizontal" textField="label" valueField="id"  value="'+value+'"  data=\''+data+'\' ></div></div>  </div>')
	   break;
	  case "checkbox":
			var saveAsName = getSaveAsName(form[key]);
			var required= getRequired(form[key]);
			var enabled=getEnabled(form[key]);
			var data;
			if(form[key].extra.importChoices=="literal"){
				data=form[key].extra.choices.entries;
			}else{
				var displayValues = form[key][form[key].extra.displayValues];
				var displayLabels = form[key][form[key].extra.displayLabels];
				if(displayValues.indexOf("[")==0){
					var displayValues = displayValues.substring(1,displayValues.length-1).split(",");
					var displayLabels = displayLabels.substring(1,displayLabels.length-1).split(",");
				}
				if(typeof(displayValues)=="string"){
					data =[{id:displayValues,label:displayLabels}];
				}else{
					var subData = [];
					for(var i=0;i<displayValues.length;i++){
						var obj = {id:displayValues[i],label:displayLabels[i]};
						subData.push(obj)
					}
					data = subData;
				}
			}
			data = JSON.stringify(data);
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key].value;
			}
			if(typeof(value)=="object"){
				value=value.join(",")
			}
			var fieldCss = "field";
				if(form[key].extra.labelPosition=="left"){
					fieldCss="field-two"
				}else if(form[key].extra.labelPosition=="above"){
					fieldCss="field-one"
				}
			//var events = setCustomEvents(key);
			$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><div id="'+form[key].extra.id+'" enabled="'+enabled+'"  '+saveAsName+' required="'+form[key].required+'" class="mini-checkboxlist" repeatItems="20" repeatLayout="table" repeatDirection="horizontal" textField="label" valueField="id"  value="'+value+'"  data=\''+data+'\' ></div></div>  </div>')
	   break;
	  case "dropdown":
			var saveAsName = getSaveAsName(form[key]);
			var required= getRequired(form[key]);
			var enabled=getEnabled(form[key]);
			var data;
			if(form[key].extra.importChoices=="literal"){
				data=form[key].extra.choices.entries;
			}else{
				var displayValues = form[key][form[key].extra.displayValues];
				var displayLabels = form[key][form[key].extra.displayLabels];
				if(displayValues.indexOf("[")==0){
					var displayValues = displayValues.substring(1,displayValues.length-1).split(",");
				}
				if(displayLabels.indexOf("[")==0){
					var displayLabels = displayLabels.substring(1,displayLabels.length-1).split(",");
				}
				if(typeof(displayValues)=="string"){
					data =[{id:displayValues,label:displayLabels}];
				}else{
					var subData = [];
					for(var i=0;i<displayValues.length;i++){
						var obj = {id:displayValues[i],label:displayLabels[i]};
						subData.push(obj)
					}
					data = subData;
				}
			}
			data = JSON.stringify(data);
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key].value;
			}
			if(value==null||value==""){
				value = form[key][form[key].extra.defaultChoice];
			}
			if(form[key].extra.view=="list"){
				var fieldName = getFieldName(form[key]);
				var vtype="";
				if(form[key].required==true){
					vtype="required"
				}
				if(enabled){
					enabled=false;
				}else{
					enabled=true;
				}
				var texts=[];
				if(value!=null&&value!=""){
					var datas = eval(data);
					if(typeof(value)=="string"){
						if(value.indexOf("[")==0){
							value = value.substring(1,value.length-1).split(",");
						}else if(value.indexOf(",")>-1){
							value = value.split(",");
						}else if(value.indexOf("; ")>-1){
							value = value.split("; ");
						}else{
							value =[value];
						}
					}
					for(var i=0;i<value.length;i++){
							var text="";
							for(var j=0;j<datas.length;j++){
								if(datas[j].id==value[i]){
									text=datas[j].label;
								}
							}
							texts.push(text);
					}
				}
				setListValue(texts,parentKey,fieldName+"Name",true);
				setListValue(value,parentKey,fieldName);

				var width = form[key].extra.customCSS;
				if(width==""||width==null){
					width="200"
				}
				$("."+parentKey+" tr").eq(0).append('<th id="'+fieldName+'Name" >'+form[key].label+'</th>')
				//$("."+parentKey+">div").append('<div field="'+fieldName+'"  name="'+fieldName+'" displayField="'+fieldName+'Name" width="'+width+'" dataType="string" allowSort="true" headerAlign="center" vtype="'+vtype+'" readOnly='+enabled+' >'+form[key].label+required+' <input property="editor"  class="mini-combobox"  textField="label" valueField="id" valueFromSelect="true" emptyText="'+form[key].instructions+'"  allowInput="true" showNullItem="true" nullItemText=""   data=\''+data+'\' /></div>  ');
			}else{
				if(typeof(value)=="object"){
					if(value!=null){
						value=value.join(",")
					}
				}
				var fieldCss = "field";
				if(form[key].extra.labelPosition=="left"){
					fieldCss="field-two"
				}else if(form[key].extra.labelPosition=="above"){
					fieldCss="field-one"
				}
				//var events = setCustomEvents(key);
				$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled="'+enabled+'"  '+saveAsName+' required="'+form[key].required+'" multiSelect="'+form[key].multiple+'"  class="mini-combobox"  valueFromSelect="true" textField="label" valueField="id" emptyText="'+form[key].instructions+'"  allowInput="true" showNullItem="true" nullItemText=""   value="'+value+'"  data=\''+data+'\' /></div>  </div>')
			}
	 break;
	    case "knowledge_center":
			var saveAsName = getSaveAsName(form[key]);
			var required= getRequired(form[key]);
			var readOnly = form[key].mutable;
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key].value;
			}
			if(form[key].extra.pickedItems!=null&&form[key].extra.pickedItems.length>0){
				var value = form[key][form[key].extra.pickedItems[0].id];
				if(value==null){
					value = [];
					for(var i=0;i<form[key].extra.pickedItems.length;i++){
						value.push(form[key].extra.pickedItems[i].id);
					}
				}
			}
			if(typeof(value)=="object"){
				if(value!=null){
					value=value.join(",")
				}
			}
			if(form[key].extra.view=="list"){
				var fieldName = getFieldName(form[key]);
				var vtype="";
				if(form[key].required==true){
					vtype="required"
				}
				var text=[];
				if(value!=null&&value!=""&&value!=","){
					$.ajax({
							url: "/suite/plugins/servlet/execute/getcontentinfo",
						   type:"post",
						   data:{id:value},
						   async:false,
							   success: function (rstext) {
									var rsList =  eval(rstext);
									for(var i=0;i<rsList.length;i++){
										text.push(rsList[i].name);
									}
									
								},
								error: function () {
							   }
					});
				}
				setListValue(text,parentKey,fieldName+"Name",true);
				setListValue(value,parentKey,fieldName);
				$("."+parentKey+" tr").eq(0).append('<th id="'+fieldName+'Name" >'+form[key].label+'</th>')
				//$("."+parentKey+">div").append('<div field="'+fieldName+'"  name="'+fieldName+'"  displayField="'+fieldName+'Name" width="200" dataType="string" allowSort="true" headerAlign="center" vtype="'+vtype+'" readOnly='+enabled+' >'+form[key].label+required+' <input property="editor"  url="/suite/plugins/servlet/execute/getknowledgecentertree"  class="mini-treeselect"  textField="name" valueField="id" parentField="parentId" emptyText="'+form[key].instructions+'" onbeforenodeselect="beforenodeselect"  expandOnNodeClick="true" allowInput="false"  /></div>  ');
			}else{
				var fieldCss = "field";
				if(form[key].extra.labelPosition=="left"){
					fieldCss="field-two"
				}else if(form[key].extra.labelPosition=="above"){
					fieldCss="field-one"
				}
				//var events = setCustomEvents(key);
				$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled="'+readOnly+'"  '+saveAsName+' required="'+form[key].required+'" multiSelect="'+form[key].multiple+'" url="/suite/plugins/servlet/execute/getknowledgecentertree"  class="mini-treeselect"  textField="name" valueField="id" parentField="parentId" emptyText="'+form[key].instructions+'" onbeforenodeselect="beforenodeselect"  expandOnNodeClick="true" allowInput="false"    value="'+value+'"  /></div>  </div>')
			}
	   break;
	   case "community":
			var saveAsName = getSaveAsName(form[key]);
			var required= getRequired(form[key]);
			var readOnly = form[key].mutable;
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key].value;
			}
			if(form[key].extra.pickedItems!=null&&form[key].extra.pickedItems.length>0){
				var value = form[key][form[key].extra.pickedItems[0].id];
				if(value==null){
					value = [];
					for(var i=0;i<form[key].extra.pickedItems.length;i++){
						value.push(form[key].extra.pickedItems[i].id);
					}
				}
			}
			if(typeof(value)=="object"){
				if(value!=null){
					value=value.join(",")
				}
			}
			if(form[key].extra.view=="list"){
				var fieldName = getFieldName(form[key]);
				var vtype="";
				if(form[key].required==true){
					vtype="required"
				}
				var text=[];	
				if(value!=null&&value!=""&&value!=","){				
					$.ajax({
							url: "/suite/plugins/servlet/execute/getcontentinfo",
						   type:"post",
						   data:{id:value},
						   async:false,
							   success: function (rstext) {
									var rsList =  eval(rstext);
									for(var i=0;i<rsList.length;i++){
										text.push(rsList[i].name);
									}
									
								},
								error: function () {
							   }
					});
				}
				setListValue(text,parentKey,fieldName+"Name",true);
				setListValue(value,parentKey,fieldName);
				$("."+parentKey+" tr").eq(0).append('<th id="'+fieldName+'Name" >'+form[key].label+'</th>')
				//$("."+parentKey+">div").append('<div field="'+fieldName+'"  name="'+fieldName+'" displayField="'+fieldName+'Name" width="150" dataType="string" allowSort="true" headerAlign="center" vtype="'+vtype+'" readOnly='+enabled+' >'+form[key].label+required+' <input property="editor"  url="/suite/plugins/servlet/execute/getcommunitytree"  class="mini-treeselect"  textField="name" valueField="id" parentField="parentId" emptyText="'+form[key].instructions+'" onbeforenodeselect="beforenodeselect" expandOnNodeClick="true"  allowInput="false"  /></div>  ');
			}else{
				var fieldCss = "field";
				if(form[key].extra.labelPosition=="left"){
					fieldCss="field-two"
				}else if(form[key].extra.labelPosition=="above"){
					fieldCss="field-one"
				}
				//var events = setCustomEvents(key);
				$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled="'+readOnly+'"  '+saveAsName+' required="'+form[key].required+'" multiSelect="'+form[key].multiple+'" url="/suite/plugins/servlet/execute/getcommunitytree"  class="mini-treeselect"  textField="name" valueField="id" parentField="parentId" emptyText="'+form[key].instructions+'" onbeforenodeselect="beforenodeselect" expandOnNodeClick="true"  allowInput="false"    value="'+value+'"  /></div>  </div>')
			}
	   break;
	   case "content":
			var saveAsName = getSaveAsName(form[key]);
			var required= getRequired(form[key]);
			var readOnly = form[key].mutable;
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key].value;
			}
			if(form[key].extra.pickedItems!=null&&form[key].extra.pickedItems.length>0){
				var value = form[key][form[key].extra.pickedItems[0].id];
				if(value==null){
					value = [];
					for(var i=0;i<form[key].extra.pickedItems.length;i++){
						value.push(form[key].extra.pickedItems[i].id);
					}
				}
			}
			if(typeof(value)=="object"){
				if(value!=null){
					value=value.join(",")
				}
			}
			if(form[key].extra.view=="list"){
				var fieldName = getFieldName(form[key]);
				var vtype="";
				if(form[key].required==true){
					vtype="required"
				}
				var text=[];	
				if(value!=null&&value!=""&&value!=","){				
					$.ajax({
						url: "/suite/plugins/servlet/execute/getcontentinfo",
					   type:"post",
					   data:{id:value},
					   async:false,
						   success: function (rstext) {
								var rsList =  eval(rstext);
								for(var i=0;i<rsList.length;i++){
									text.push(rsList[i].name);
								}
								
							},
							error: function () {
						   }
					});
				}
				setListValue(text,parentKey,fieldName+"Name",true);
				setListValue(value,parentKey,fieldName);
				$("."+parentKey+" tr").eq(0).append('<th id="'+fieldName+'Name" >'+form[key].label+'</th>')
				//if(form[key].extra.subType=="folder"){
				//	$("."+parentKey+">div").append('<div field="'+fieldName+'"  name="'+fieldName+'" displayField="'+fieldName+'Name" width="250" dataType="string" allowSort="true" headerAlign="center" vtype="'+vtype+'" readOnly='+enabled+' >'+form[key].label+required+' <input property="editor"  url="/suite/plugins/servlet/execute/getfoldertree?issub=false"  class="mini-treeselect"  textField="name" valueField="id" parentField="parentId" emptyText="'+form[key].instructions+'" onbeforenodeselect="beforefolderselect" onbeforenodecheck="beforefolderselect"  allowInput="false" showFolderCheckBox="true" expandOnNodeClick="true"  /></div>  ');
				//}else if(form[key].extra.subType=="document"){
				//	$("."+parentKey+">div").append('<div field="'+fieldName+'"  name="'+fieldName+'" displayField="'+fieldName+'Name" width="250" dataType="string" allowSort="true" headerAlign="center" vtype="'+vtype+'" readOnly='+enabled+' >'+form[key].label+required+' <input property="editor"  url="/suite/plugins/servlet/execute/getfoldertree?issub=true"  class="mini-treeselect"  textField="name" valueField="id" parentField="parentId" emptyText="'+form[key].instructions+'" onbeforenodeselect="beforedocumentselect" onbeforenodecheck="beforedocumentselect" expandOnNodeClick="true"  allowInput="false"  /></div>  ');
			//	}else if(form[key].extra.subType=="content"){
				//	$("."+parentKey+">div").append('<div field="'+fieldName+'"  name="'+fieldName+'" displayField="'+fieldName+'Name" width="250" dataType="string" allowSort="true" headerAlign="center" vtype="'+vtype+'" readOnly='+enabled+' >'+form[key].label+required+' <input property="editor"  url="/suite/plugins/servlet/execute/getfoldertree?issub=true"  class="mini-treeselect"  textField="name" valueField="id" parentField="parentId" emptyText="'+form[key].instructions+'" onbeforenodeselect="beforecontentselect" onbeforenodecheck="beforecontentselect" expandOnNodeClick="true"  allowInput="false" showFolderCheckBox="true"  /></div>  ');
			//	}
				
			}else{
				var fieldCss = "field";
				if(form[key].extra.labelPosition=="left"){
					fieldCss="field-two"
				}else if(form[key].extra.labelPosition=="above"){
					fieldCss="field-one"
				}
				//var events = setCustomEvents(key);
				if(form[key].extra.subType=="folder"){
					$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled="'+readOnly+'"  '+saveAsName+' required="'+form[key].required+'" multiSelect="'+form[key].multiple+'" url="/suite/plugins/servlet/execute/getfoldertree?issub=false"  class="mini-treeselect"  textField="name" valueField="id" parentField="parentId" emptyText="'+form[key].instructions+'" onbeforenodeselect="beforefolderselect" onbeforenodecheck="beforefolderselect"  allowInput="false" showFolderCheckBox="true" expandOnNodeClick="true"    value="'+value+'"  /></div>  </div>')
				}else if(form[key].extra.subType=="document"){
					$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled="'+readOnly+'"  '+saveAsName+' required="'+form[key].required+'" multiSelect="'+form[key].multiple+'" url="/suite/plugins/servlet/execute/getfoldertree?issub=true"  class="mini-treeselect"  textField="name" valueField="id" parentField="parentId" emptyText="'+form[key].instructions+'" onbeforenodeselect="beforedocumentselect" onbeforenodecheck="beforedocumentselect" expandOnNodeClick="true"  allowInput="false"    value="'+value+'"  /></div>  </div>')
				}else if(form[key].extra.subType=="content"){
					$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled="'+readOnly+'"  '+saveAsName+' required="'+form[key].required+'" multiSelect="'+form[key].multiple+'" url="/suite/plugins/servlet/execute/getfoldertree?issub=true"  class="mini-treeselect"  textField="name" valueField="id" parentField="parentId" emptyText="'+form[key].instructions+'" onbeforenodeselect="beforecontentselect" onbeforenodecheck="beforecontentselect" expandOnNodeClick="true"  allowInput="false" showFolderCheckBox="true"   value="'+value+'"  /></div>  </div>')
				}
			}
	   break;
	  case "truefalse":
			var saveAsName = getSaveAsName(form[key]);
			var required= getRequired(form[key]);
			var enabled=getEnabled(form[key]);
			var data;
			var yesLabel = form[key].extra.yesLabel;
			var noLabel = form[key].extra.noLabel;
			data =[{id:1,label:yesLabel},{id:0,label:noLabel}];
			data = JSON.stringify(data);
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key].value;
			}
			if(value=="true"){
				value=1;
			}else if(value=="false"){
				value=0;
			}
			if(form[key].extra.view=="list"){
				var fieldName = getFieldName(form[key]);
				var vtype="";
				if(form[key].required==true){
					vtype="required"
				}
				if(enabled){
					enabled=false;
				}else{
					enabled=true;
				}
				setListValue(value,parentKey,fieldName);
				$("."+parentKey+" tr").eq(0).append('<th id="'+fieldName+'" >'+form[key].label+'</th>')
				//$("."+parentKey+">div").append('<div field="'+fieldName+'"  name="'+fieldName+'" dataType="string" allowSort="true" headerAlign="center" vtype="'+vtype+'" readOnly='+enabled+' type="checkboxcolumn"  trueValue="1" falseValue="0" width="60" >'+form[key].label+required+'</div>');
			}else{
				if(value!=null){
					if(value=="true"||value=="1"){
						value=1;
					}else{
						value=0;
					}
				}else{
					value="";
				}
				var fieldCss = "field";
				if(form[key].extra.labelPosition=="left"){
					fieldCss="field-two"
				}else if(form[key].extra.labelPosition=="above"){
					fieldCss="field-one"
				}
				//var events = setCustomEvents(key);
				$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><div id="'+form[key].extra.id+'" enabled="'+enabled+'"  '+saveAsName+' required="'+form[key].required+'" class="mini-radiobuttonlist" repeatItems="20" repeatLayout="table" repeatDirection="horizontal" textField="label" valueField="id"  value="'+value+'"  data=\''+data+'\' ></div></div>  </div>')
			}
	  break;
	  case "datetime":
			var saveAsName = getSaveAsName(form[key]);
			var required= getRequired(form[key]);
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key][form[key].extra.expressionValueString];
			}
			var fieldCss = "field";
				if(form[key].extra.labelPosition=="left"){
					fieldCss="field-two"
				}else if(form[key].extra.labelPosition=="above"){
					fieldCss="field-one"
				}
			//var events = setCustomEvents(key);
			if(form[key].extra.subType=="datetime"){
				$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled='+form[key].mutable+'  '+saveAsName+' required="'+form[key].required+'"  value="'+value+'" allowInput="false" class="mini-datepicker" valueType="string"   nullValue="null" format="yyyy-MM-dd H:mm" timeFormat="H:mm" showTime="true" showOkButton="true" showClearButton="false" /></div>  </div>')
			}else if(form[key].extra.subType=="date"){
				$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled='+form[key].mutable+'  '+saveAsName+' required="'+form[key].required+'"  value="'+value+'" allowInput="false" class="mini-datepicker" valueType="string"  /></div>  </div>')
			}else if(form[key].extra.subType=="time"){
				$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled='+form[key].mutable+'  '+saveAsName+' required="'+form[key].required+'"  value="'+value+'"  class="mini-timespinner"  format="H:mm"  /></div>  </div>')
			}
	   break;
	
	  case "password":
			var saveAsName = getSaveAsName(form[key]);
			var required= getRequired(form[key]);
			var enabled=getEnabled(form[key]);
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key].value;
			}
			var fieldCss = "field";
				if(form[key].extra.labelPosition=="left"){
					fieldCss="field-two"
				}else if(form[key].extra.labelPosition=="above"){
					fieldCss="field-one"
				}
			//var events = setCustomEvents(key);
			$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled="'+enabled+'" '+saveAsName+' emptyText="'+form[key].instructions+'" required="'+form[key].required+'" class="mini-password"  value="'+value+'" /></div>  </div>')
	   break;
	  case "hidden":
			var saveAsName = getSaveAsName(form[key]);
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				value = form[key].value;
			}
			$("#"+parentKey).append('<input id="'+form[key].extra.id+'"  '+saveAsName+' visible="false"  class="mini-textbox" value="'+value+'" />')
	   break;
	  case "link":
			 var defaultUrlValue = form[key][form[key].extra.defaultUrlValue];
			 if(defaultUrlValue==null){
				 defaultUrlValue = form[key].extra.defaultUrlValue;
			 }
			 if(typeof(defaultUrlValue)=="string"){
						if(defaultUrlValue.indexOf("[")==0){
							defaultUrlValue = defaultUrlValue.substring(1,defaultUrlValue.length-1).split(",");
						}else if(defaultUrlValue.indexOf("http://")==-1){
							defaultUrlValue=[defaultUrlValue];
						}
			}
			
			 var linkData;
			 if(typeof(defaultUrlValue)=="string"){
				 linkData="<a href='"+defaultUrlValue+"' target='_blank' >"+form[key].extra.defaultTitleValue+"</a>"
				 $("#"+parentKey).append('<div class="field" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：</div><div class="form-field">'+linkData+'</div>  </div>')
			 }else{
				 $("#"+parentKey).append('<div class="field-one" id="'+form[key].extra.id+'_field" style="height:116px;" ><div class="form-label" style="height:100px;" >'+form[key].label+'：</div><div class="form-field" style="height:100px;" ><div id="'+form[key].extra.id+'Div" style="width:2000px;overflow:auto;" ></div> </div> </div>')
				 if(defaultUrlValue!=""){
				 for(var i=0;i<defaultUrlValue.length;i++){
					var rs				
					$.ajax({
						url: "/suite/plugins/servlet/execute/getdocumentsinfo",
					   type:"post",
					   data:{id:defaultUrlValue[i]},
					   async:false,
						   success: function (rstext) {
								rs = eval(rstext)[0];
							},
							error: function () {
						   }
					});
					if(!rs){
						linkData="<a href='"+defaultUrlValue[i]+"' target='_blank' >"+form[key].extra.defaultTitleValue[i]+"</a>" 
						$("#"+form[key].extra.id+"Div").append(linkData);
					}else{
							var img = "";
							 if(rs.ext=="jpg"||rs.ext=="png"||rs.ext=="gif"){
								img="<img src='/suite/doc/"+rs.id+"' style='height:60px;border:0px;' >";
							 }else{
								img="<img src='/suite/plugins/img/attach/attach.png'  style='height:60px;border:0px;' >";
							 }
							 var div="<div   style='border: 1px solid #DEE5E7;background-color: #EDF1F2;display: block;float: left;margin-right:2px;' >  <div  style='border-bottom: 1px solid #DEE5E7;padding: 5px;' >"+rs.name+"."+rs.ext+"</div> <div  style='height:60px;width:100%;text-align: center;background-color: #F3F5F6;padding-bottom:3px;padding-top:3px;' > 				<a  href='/suite/doc/"+rs.id+"' >"+img+"</a> 			  </div> 			</div>"
							$("#"+form[key].extra.id+"Div").append(div);	
					 }
				 }
				 }
			 }
		break;
		case "image":
			if(form[key].extra.source=="chooseFile"){
				 var srcFile = form[key][form[key].extra.srcFile];
				 if(srcFile==null){
						var rs="";
						var div="";
						if(form[key].extra.srcFile!=null&&form[key].extra.srcFile!=""){
							rs = form[key].extra.srcFile[0];
							var img = "";
							 if(rs.extension=="jpg"||rs.extension=="png"||rs.extension=="gif"){
								img="<img src='/suite/doc/"+rs.id+"' style='height:60px;border:0px;' >";
							 }else{
								img="<img src='/suite/plugins/img/attach/attach.png'  style='height:60px;border:0px;' >";
							 }
							 div="<div style='border: 1px solid #DEE5E7;background-color: #EDF1F2;display: block;float: left;margin-right:2px;' >  <div  style='border-bottom: 1px solid #DEE5E7;padding: 5px;' >"+rs.name+"."+rs.extension+"</div> <div  style='height:60px;width:100%;text-align: center;background-color: #F3F5F6;padding-bottom:3px;padding-top:3px;' > 				<a  href='/suite/doc/"+rs.id+"' >"+img+"</a> 			  </div> 			</div>"
						}
							$("#"+parentKey).append('<div class="field-one" style="height:116px;" ><div class="form-label" style="height:100px;" >'+form[key].label+'：</div><div class="form-field" style="height:100px;" ><div id="'+form[key].extra.id+'Div" style="width:2000px;overflow:auto;" >'+div+'</div></div>  </div>')
						
				}else{
						 $("#"+parentKey).append('<div class="field-one" id="'+form[key].extra.id+'_field" style="height:116px;" ><div class="form-label" style="height:100px;" >'+form[key].label+'：</div><div class="form-field" style="height:100px;" ><div id="'+form[key].extra.id+'Div" style="width:2000px;overflow:auto;" ></div></div>  </div>')
						 for(var i=0;i<srcFile.length;i++){
							var rs				
							$.ajax({
								url: "/suite/plugins/servlet/execute/getdocumentsinfo",
							   type:"post",
							   data:{id:srcFile[i]},
							   async:false,
								   success: function (rstext) {
										rs = eval(rstext)[0];
									},
									error: function () {
								   }
							});
							if(rs==""){
								linkData="<a href='"+defaultUrlValue[i]+"' target='_blank' >"+form[key].extra.defaultTitleValue[i]+"</a>" 
								$("#"+form[key].extra.id+"Div").append(linkData);
							}else{
									var img = "";
									 if(rs.ext=="jpg"||rs.ext=="png"||rs.ext=="gif"){
										img="<img src='/suite/doc/"+rs.id+"' style='height:60px;border:0px;' >";
									 }else{
										img="<img src='/suite/plugins/img/attach/attach.png'  style='height:60px;border:0px;' >";
									 }
									 var div="<div  style='border: 1px solid #DEE5E7;background-color: #EDF1F2;display: block;float: left;margin-right:2px;' >  <div  style='border-bottom: 1px solid #DEE5E7;padding: 5px;' >"+rs.name+"."+rs.ext+"</div> <div  style='height:60px;width:100%;text-align: center;background-color: #F3F5F6;padding-bottom:3px;padding-top:3px;' > 				<a  href='/suite/doc/"+rs.id+"' >"+img+"</a> 			  </div> 			</div>"
									$("#"+form[key].extra.id+"Div").append(div);	
							 }
						 }
				 }
			}else{
				var srcURL = form[key].extra.srcURL.split(",");
				var div="";
				for(var i=0;i<srcURL.length;i++){
					var img="<img src='"+srcURL[i]+"' style='height:60px;border:0px;' >";
					div+="<div style='border: 1px solid #DEE5E7;background-color: #EDF1F2;display: block;float: left;margin-right:2px;' >  <div  style='border-bottom: 1px solid #DEE5E7;padding: 5px;' >"+srcURL[i]+"</div> <div  style='height:60px;width:100%;text-align: center;background-color: #F3F5F6;padding-bottom:3px;padding-top:3px;' > 				<a  href='"+srcURL[i]+"' >"+img+"</a> 			  </div> 			</div>"
				}
				$("#"+parentKey).append('<div class="field-one" id="'+form[key].extra.id+'_field" style="height:116px;" ><div class="form-label" style="height:100px;" >'+form[key].label+'：</div><div class="form-field" style="height:100px;" ><div style="width:2000px;overflow:auto;" >'+div+'</div></div>  </div>')
			}
		break;
	   case "people":
			var saveAsName = getSaveAsName(form[key]);
			var required= getRequired(form[key]);
			var enabled = form[key].mutable;
			var text="";
			var value = form[key].acValue;
			if(form[key].acValue==null||form[key].acValue.length==0){
				var pickedItems = form[key].extra.pickedItems;
				if(pickedItems!=null){
				for(var i=0;i<pickedItems.length;i++){
					if(i==0){
						if(pickedItems[i].id.toString().indexOf("###")>-1){
							if(typeof(form[key][form[key].extra.pickedItems[0].id])=="string"||typeof(form[key][form[key].extra.pickedItems[0].id])=="number"){
								value=form[key][form[key].extra.pickedItems[0].id];
							}else{
								if(form[key][form[key].extra.pickedItems[0].id]!=null){
									value=form[key][form[key].extra.pickedItems[0].id].join(",");
								}
							}
						}else{
							value=pickedItems[i].id
						}
					}else{
						if(pickedItems[i].id.toString().indexOf("###")>-1){
							if(typeof(form[key][form[key].extra.pickedItems[0].id])=="string"||typeof(form[key][form[key].extra.pickedItems[0].id])=="number"){
								value=","+form[key][form[key].extra.pickedItems[0].id];
							}else{
								if(form[key][form[key].extra.pickedItems[0].id]!=null){
									value=","+form[key][form[key].extra.pickedItems[0].id].join(",");
								}
							}
						}else{
							value=value+","+pickedItems[i].id;
						}
					}
				}
				}
			}else{
				if(typeof(value)=="object"){
					value=value.join(",")
				}
			}
			if(value!=""&&value!=null&&value!=" , "){
				$.ajax({
					url: "/suite/plugins/servlet/getUsersAndGroupsName",
					   type:"post",
					   data:{recordValue:value},
					   async:false,
						   success: function (rstext) {
								text = rstext;
							},
							error: function () {
						   }
				});
			}else{
				value = "";
			}
			if(form[key].extra.view=="list"){
				var fieldName = getFieldName(form[key]);
				var vtype="";
				if(form[key].required==true){
					vtype="required"
				}
				if(enabled){
					enabled=false;
				}else{
					enabled=true;
				}
				setListValue(value,parentKey,fieldName);
				setListValue(text,parentKey,fieldName+"Name",true);
				var width = form[key].extra.customCSS;
				if(width==""||width==null){
					width="150"
				}
				$("."+parentKey+" tr").eq(0).append('<th id="'+fieldName+'Name" >'+form[key].label+'</th>')
				//if(form[key].extra.subType=="user"){
				//	$("."+parentKey+">div").append('<div field="'+fieldName+'"  name="'+fieldName+'" displayField="'+fieldName+'Name" width="'+width+'" dataType="string" allowSort="true" headerAlign="center" vtype="'+vtype+'" readOnly='+enabled+' >'+form[key].label+required+' <input property="editor"  class="mini-autocomplete"  searchField="recordValue" url="/suite/plugins/servlet/searchUsersAndGroup?recordType=1,2,4&operator=2&type=1" valueFromSelect="true"  valueField="id" textField="name"  /></div>  ');
				//}else if(form[key].extra.subType=="group"){
				//	$("."+parentKey+">div").append('<div field="'+fieldName+'"  name="'+fieldName+'" displayField="'+fieldName+'Name" width="'+width+'" dataType="string" allowSort="true" headerAlign="center" vtype="'+vtype+'" readOnly='+enabled+' >'+form[key].label+required+' <input property="editor"  class="mini-autocomplete"  searchField="recordValue" url="/suite/plugins/servlet/searchUsersAndGroup?recordType=1,2,4&operator=2&type=2" valueFromSelect="true" valueField="id" textField="name"  /></div>  ');
				//}else if(form[key].extra.subType=="people"){
				//	$("."+parentKey+">div").append('<div field="'+fieldName+'"  name="'+fieldName+'" displayField="'+fieldName+'Name" width="'+width+'" dataType="string" allowSort="true" headerAlign="center" vtype="'+vtype+'" readOnly='+enabled+' >'+form[key].label+required+' <input property="editor"  class="mini-autocomplete"  searchField="recordValue" url="/suite/plugins/servlet/searchUsersAndGroup?recordType=1,2,4&operator=2" valueFromSelect="true" valueField="id" textField="name" /></div>  ');
				//}
			}else{
				var fieldCss = "field";
				if(form[key].extra.labelPosition=="left"){
					fieldCss="field-two"
				}else if(form[key].extra.labelPosition=="above"){
					fieldCss="field-one"
				}
				//var events = setCustomEvents(key);
				if(form[key].extra.subType=="user"){
					$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled="'+enabled+'"  '+saveAsName+' required="'+form[key].required+'"  multiSelect="'+form[key].multiple+'" class="mini-textboxlist"  searchField="recordValue" url="/suite/plugins/servlet/searchUsersAndGroup?recordType=1,2,4&operator=2&type=1"  value="'+value+'" text="'+text+'"  onvaluechanged="isMultipleTheAllowInput(this,'+form[key].multiple+')" valueField="id" textField="name" /></div>  </div>')
				}else if(form[key].extra.subType=="group"){
					$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled="'+enabled+'"  '+saveAsName+' required="'+form[key].required+'" multiSelect="'+form[key].multiple+'" class="mini-textboxlist"  searchField="recordValue" url="/suite/plugins/servlet/searchUsersAndGroup?recordType=1,2,4&operator=2&type=2"  value="'+value+'" text="'+text+'" onvaluechanged="isMultipleTheAllowInput(this,'+form[key].multiple+')" valueField="id" textField="name" /></div>  </div>')
				}else if(form[key].extra.subType=="people"){
					$("#"+parentKey).append('<div class="'+fieldCss+'" id="'+form[key].extra.id+'_field" ><div class="form-label" >'+form[key].label+'：'+required+'</div><div class="form-field"><input id="'+form[key].extra.id+'" enabled="'+enabled+'"  '+saveAsName+' required="'+form[key].required+'" multiSelect="'+form[key].multiple+'"  class="mini-textboxlist"  searchField="recordValue" url="/suite/plugins/servlet/searchUsersAndGroup?recordType=1,2,4&operator=2"  value="'+value+'" text="'+text+'" onvaluechanged="isMultipleTheAllowInput(this,'+form[key].multiple+')" valueField="id" textField="name" /></div>  </div>')
				}
			}
		break;
	 default:
	   ""
	 }
	 } 
 }
 
